Converge the TPM drivers in the Xen repository
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Fri, 3 Feb 2006 09:31:28 +0000 (09:31 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Fri, 3 Feb 2006 09:31:28 +0000 (09:31 +0000)
with those coming from the 2.6.15 kernel. Some files can now be
taken from 2.6.15 directly and can therefore be removed.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
linux-2.6-xen-sparse/drivers/char/tpm/tpm.c
linux-2.6-xen-sparse/drivers/char/tpm/tpm.h
linux-2.6-xen-sparse/drivers/char/tpm/tpm_atmel.c [deleted file]
linux-2.6-xen-sparse/drivers/char/tpm/tpm_nsc.c [deleted file]
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c

index 33e20abf894a9626aa9720b4c7243e731471c676..14f9539a4b5445a275d9327af7569318721011c1 100644 (file)
@@ -28,9 +28,6 @@
 #include <linux/spinlock.h>
 #include "tpm.h"
 
-#define TPM_CHIP_NUM_MASK      0x0000ffff
-#define TPM_CHIP_TYPE_SHIFT    16      
-
 enum tpm_const {
        TPM_MINOR = 224,        /* officially assigned */
        TPM_MIN_BUFSIZE = 2048,
index 5ad38c7c93d0a9f1601fcdef67891daf36d86bd7..8908179c669db9a115732ebbfaf1e86e037466e5 100644 (file)
@@ -50,9 +50,12 @@ struct tpm_vendor_specific {
        u8 req_complete_mask;
        u8 req_complete_val;
        u8 req_canceled;
-       u16 base;               /* TPM base address */
-       int drv_type;
        u32 buffersize;
+       void __iomem *iobase;           /* ioremapped address */
+       unsigned long base;             /* TPM base address */
+
+       int region_size;
+       int have_region;
 
        int (*recv) (struct tpm_chip *, u8 *, size_t);
        int (*send) (struct tpm_chip *, u8 *, size_t);
@@ -106,8 +109,8 @@ extern ssize_t tpm_write(struct file *, const char __user *, size_t,
                         loff_t *);
 extern ssize_t tpm_read(struct file *, char __user *, size_t, loff_t *);
 extern void tpm_remove_hardware(struct device *);
-extern int tpm_pm_suspend(struct pci_dev *, pm_message_t);
-extern int tpm_pm_resume(struct pci_dev *);
+extern int tpm_pm_suspend(struct device *, pm_message_t);
+extern int tpm_pm_resume(struct device *);
 
 #ifdef CONFIG_ACPI
 extern struct dentry ** tpm_bios_log_setup(char *);
diff --git a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_atmel.c b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_atmel.c
deleted file mode 100644 (file)
index 4238693..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2004 IBM Corporation
- *
- * Authors:
- * Leendert van Doorn <leendert@watson.ibm.com>
- * Dave Safford <safford@watson.ibm.com>
- * Reiner Sailer <sailer@watson.ibm.com>
- * Kylene Hall <kjhall@us.ibm.com>
- *
- * Maintained by: <tpmdd_devel@lists.sourceforge.net>
- *
- * Device driver for TCG/TCPA TPM (trusted platform module).
- * Specifications at www.trustedcomputinggroup.org      
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, version 2 of the
- * License.
- * 
- */
-
-#include "tpm.h"
-#include "tpm_atmel.h"
-
-/* write status bits */
-enum tpm_atmel_write_status {
-       ATML_STATUS_ABORT = 0x01,
-       ATML_STATUS_LASTBYTE = 0x04
-};
-/* read status bits */
-enum tpm_atmel_read_status {
-       ATML_STATUS_BUSY = 0x01,
-       ATML_STATUS_DATA_AVAIL = 0x02,
-       ATML_STATUS_REWRITE = 0x04,
-       ATML_STATUS_READY = 0x08
-};
-
-static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
-{
-       u8 status, *hdr = buf;
-       u32 size;
-       int i;
-       __be32 *native_size;
-
-       /* start reading header */
-       if (count < 6)
-               return -EIO;
-
-       for (i = 0; i < 6; i++) {
-               status = atmel_getb(chip, 1);
-               if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
-                       dev_err(chip->dev, "error reading header\n");
-                       return -EIO;
-               }
-               *buf++ = atmel_getb(chip, 0);
-       }
-
-       /* size of the data received */
-       native_size = (__force __be32 *) (hdr + 2);
-       size = be32_to_cpu(*native_size);
-
-       if (count < size) {
-               dev_err(chip->dev,
-                       "Recv size(%d) less than available space\n", size);
-               for (; i < size; i++) { /* clear the waiting data anyway */
-                       status = atmel_getb(chip, 1);
-                       if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
-                               dev_err(chip->dev, "error reading data\n");
-                               return -EIO;
-                       }
-               }
-               return -EIO;
-       }
-
-       /* read all the data available */
-       for (; i < size; i++) {
-               status = atmel_getb(chip, 1);
-               if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
-                       dev_err(chip->dev, "error reading data\n");
-                       return -EIO;
-               }
-               *buf++ = atmel_getb(chip, 0);
-       }
-
-       /* make sure data available is gone */
-       status = atmel_getb(chip, 1);
-       if (status & ATML_STATUS_DATA_AVAIL) {
-               dev_err(chip->dev, "data available is stuck\n");
-               return -EIO;
-       }
-
-       return size;
-}
-
-static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count)
-{
-       int i;
-
-       dev_dbg(chip->dev, "tpm_atml_send:\n");
-       for (i = 0; i < count; i++) {
-               dev_dbg(chip->dev, "%d 0x%x(%d)\n",  i, buf[i], buf[i]);
-               atmel_putb(buf[i], chip, 0);
-       }
-
-       return count;
-}
-
-static void tpm_atml_cancel(struct tpm_chip *chip)
-{
-       atmel_putb(ATML_STATUS_ABORT, chip, 1);
-}
-
-static u8 tpm_atml_status(struct tpm_chip *chip)
-{
-       return atmel_getb(chip, 1);
-}
-
-static struct file_operations atmel_ops = {
-       .owner = THIS_MODULE,
-       .llseek = no_llseek,
-       .open = tpm_open,
-       .read = tpm_read,
-       .write = tpm_write,
-       .release = tpm_release,
-};
-
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR |S_IWGRP, NULL, tpm_store_cancel);
-
-static struct attribute* atmel_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       NULL,
-};
-
-static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs };
-
-static struct tpm_vendor_specific tpm_atmel = {
-       .recv = tpm_atml_recv,
-       .send = tpm_atml_send,
-       .cancel = tpm_atml_cancel,
-       .status = tpm_atml_status,
-       .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
-       .req_complete_val = ATML_STATUS_DATA_AVAIL,
-       .req_canceled = ATML_STATUS_READY,
-       .attr_group = &atmel_attr_grp,
-       .miscdev = { .fops = &atmel_ops, },
-};
-
-static struct platform_device *pdev;
-
-static void atml_plat_remove(void)
-{
-       struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);
-
-       if (chip) {
-               if (chip->vendor->have_region)
-                       atmel_release_region(chip->vendor->base,
-                                            chip->vendor->region_size);
-               atmel_put_base_addr(chip->vendor);
-               tpm_remove_hardware(chip->dev);
-               platform_device_unregister(pdev);
-       }
-}
-
-static struct device_driver atml_drv = {
-       .name = "tpm_atmel",
-       .bus = &platform_bus_type,
-       .owner = THIS_MODULE,
-       .suspend = tpm_pm_suspend,
-       .resume = tpm_pm_resume,
-};
-
-static int __init init_atmel(void)
-{
-       int rc = 0;
-
-       driver_register(&atml_drv);
-
-       if ((tpm_atmel.iobase = atmel_get_base_addr(&tpm_atmel)) == NULL) {
-               rc = -ENODEV;
-               goto err_unreg_drv;
-       }
-
-       /* query chip for its version number */
-       if ((version[0] = tpm_read_index(TPM_ADDR, 0x00)) != 0xFF) {
-               version[1] = tpm_read_index(TPM_ADDR, 0x01);
-               version[2] = tpm_read_index(TPM_ADDR, 0x02);
-               version[3] = tpm_read_index(TPM_ADDR, 0x03);
-       } else {
-               dev_info(&pci_dev->dev, "version query failed\n");
-               rc = -ENODEV;
-               goto out_err;
-       }
-
-       if ((rc = tpm_register_hardware(&pci_dev->dev, &tpm_atmel)) < 0)
-               goto out_err;
-
-       dev_info(&pci_dev->dev,
-                "Atmel TPM version %d.%d.%d.%d\n", version[0], version[1],
-                version[2], version[3]);
-
-       return 0;
-out_err:
-       pci_disable_device(pci_dev);
-       return rc;
-}
-
-static void __devexit tpm_atml_remove(struct pci_dev *pci_dev) 
-{
-       struct tpm_chip *chip = pci_get_drvdata(pci_dev);
-
-       if ( chip )
-               tpm_remove_hardware(chip->dev);
-}
-
-static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)},
-       {PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6LPC)},
-       {0,}
-};
-
-MODULE_DEVICE_TABLE(pci, tpm_pci_tbl);
-
-static struct pci_driver atmel_pci_driver = {
-       .name = "tpm_atmel",
-       .id_table = tpm_pci_tbl,
-       .probe = tpm_atml_init,
-       .remove = __devexit_p(tpm_atml_remove),
-       .suspend = tpm_pm_suspend,
-       .resume = tpm_pm_resume,
-};
-
-static int __init init_atmel(void)
-{
-       return pci_register_driver(&atmel_pci_driver);
-}
-
-static void __exit cleanup_atmel(void)
-{
-       pci_unregister_driver(&atmel_pci_driver);
-}
-
-fs_initcall(init_atmel);
-module_exit(cleanup_atmel);
-
-MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
-MODULE_DESCRIPTION("TPM Driver");
-MODULE_VERSION("2.0");
-MODULE_LICENSE("GPL");
diff --git a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_nsc.c b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_nsc.c
deleted file mode 100644 (file)
index 9d3a82b..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (C) 2004 IBM Corporation
- *
- * Authors:
- * Leendert van Doorn <leendert@watson.ibm.com>
- * Dave Safford <safford@watson.ibm.com>
- * Reiner Sailer <sailer@watson.ibm.com>
- * Kylene Hall <kjhall@us.ibm.com>
- *
- * Maintained by: <tpmdd_devel@lists.sourceforge.net>
- *
- * Device driver for TCG/TCPA TPM (trusted platform module).
- * Specifications at www.trustedcomputinggroup.org      
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, version 2 of the
- * License.
- * 
- */
-
-#include "tpm.h"
-
-/* National definitions */
-enum tpm_nsc_addr{
-       TPM_NSC_IRQ = 0x07,
-       TPM_NSC_BASE0_HI = 0x60,
-       TPM_NSC_BASE0_LO = 0x61,
-       TPM_NSC_BASE1_HI = 0x62,
-       TPM_NSC_BASE1_LO = 0x63
-};
-
-enum tpm_nsc_index {
-       NSC_LDN_INDEX = 0x07,
-       NSC_SID_INDEX = 0x20,
-       NSC_LDC_INDEX = 0x30,
-       NSC_DIO_INDEX = 0x60,
-       NSC_CIO_INDEX = 0x62,
-       NSC_IRQ_INDEX = 0x70,
-       NSC_ITS_INDEX = 0x71
-};
-
-enum tpm_nsc_status_loc {
-       NSC_STATUS = 0x01,
-       NSC_COMMAND = 0x01,
-       NSC_DATA = 0x00
-};
-
-/* status bits */
-enum tpm_nsc_status {
-       NSC_STATUS_OBF = 0x01,  /* output buffer full */
-       NSC_STATUS_IBF = 0x02,  /* input buffer full */
-       NSC_STATUS_F0 = 0x04,   /* F0 */
-       NSC_STATUS_A2 = 0x08,   /* A2 */
-       NSC_STATUS_RDY = 0x10,  /* ready to receive command */
-       NSC_STATUS_IBR = 0x20   /* ready to receive data */
-};
-
-/* command bits */
-enum tpm_nsc_cmd_mode {
-       NSC_COMMAND_NORMAL = 0x01,      /* normal mode */
-       NSC_COMMAND_EOC = 0x03,
-       NSC_COMMAND_CANCEL = 0x22
-};
-/*
- * Wait for a certain status to appear
- */
-static int wait_for_stat(struct tpm_chip *chip, u8 mask, u8 val, u8 * data)
-{
-       unsigned long stop;
-
-       /* status immediately available check */
-       *data = inb(chip->vendor->base + NSC_STATUS);
-       if ((*data & mask) == val)
-               return 0;
-
-       /* wait for status */
-       stop = jiffies + 10 * HZ;
-       do {
-               msleep(TPM_TIMEOUT);
-               *data = inb(chip->vendor->base + 1);
-               if ((*data & mask) == val)
-                       return 0;
-       }
-       while (time_before(jiffies, stop));
-
-       return -EBUSY;
-}
-
-static int nsc_wait_for_ready(struct tpm_chip *chip)
-{
-       int status;
-       unsigned long stop;
-
-       /* status immediately available check */
-       status = inb(chip->vendor->base + NSC_STATUS);
-       if (status & NSC_STATUS_OBF)
-               status = inb(chip->vendor->base + NSC_DATA);
-       if (status & NSC_STATUS_RDY)
-               return 0;
-
-       /* wait for status */
-       stop = jiffies + 100;
-       do {
-               msleep(TPM_TIMEOUT);
-               status = inb(chip->vendor->base + NSC_STATUS);
-               if (status & NSC_STATUS_OBF)
-                       status = inb(chip->vendor->base + NSC_DATA);
-               if (status & NSC_STATUS_RDY)
-                       return 0;
-       }
-       while (time_before(jiffies, stop));
-
-       dev_info(chip->dev, "wait for ready failed\n");
-       return -EBUSY;
-}
-
-
-static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
-{
-       u8 *buffer = buf;
-       u8 data, *p;
-       u32 size;
-       __be32 *native_size;
-
-       if (count < 6)
-               return -EIO;
-
-       if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) {
-               dev_err(chip->dev, "F0 timeout\n");
-               return -EIO;
-       }
-       if ((data =
-            inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
-               dev_err(chip->dev, "not in normal mode (0x%x)\n",
-                       data);
-               return -EIO;
-       }
-
-       /* read the whole packet */
-       for (p = buffer; p < &buffer[count]; p++) {
-               if (wait_for_stat
-                   (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) {
-                       dev_err(chip->dev,
-                               "OBF timeout (while reading data)\n");
-                       return -EIO;
-               }
-               if (data & NSC_STATUS_F0)
-                       break;
-               *p = inb(chip->vendor->base + NSC_DATA);
-       }
-
-       if ((data & NSC_STATUS_F0) == 0 &&
-       (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) {
-               dev_err(chip->dev, "F0 not set\n");
-               return -EIO;
-       }
-       if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) {
-               dev_err(chip->dev,
-                       "expected end of command(0x%x)\n", data);
-               return -EIO;
-       }
-
-       native_size = (__force __be32 *) (buf + 2);
-       size = be32_to_cpu(*native_size);
-
-       if (count < size)
-               return -EIO;
-
-       return size;
-}
-
-static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
-{
-       u8 data;
-       int i;
-
-       /*
-        * If we hit the chip with back to back commands it locks up
-        * and never set IBF. Hitting it with this "hammer" seems to
-        * fix it. Not sure why this is needed, we followed the flow
-        * chart in the manual to the letter.
-        */
-       outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND);
-
-       if (nsc_wait_for_ready(chip) != 0)
-               return -EIO;
-
-       if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
-               dev_err(chip->dev, "IBF timeout\n");
-               return -EIO;
-       }
-
-       outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND);
-       if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) {
-               dev_err(chip->dev, "IBR timeout\n");
-               return -EIO;
-       }
-
-       for (i = 0; i < count; i++) {
-               if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
-                       dev_err(chip->dev,
-                               "IBF timeout (while writing data)\n");
-                       return -EIO;
-               }
-               outb(buf[i], chip->vendor->base + NSC_DATA);
-       }
-
-       if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
-               dev_err(chip->dev, "IBF timeout\n");
-               return -EIO;
-       }
-       outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND);
-
-       return count;
-}
-
-static void tpm_nsc_cancel(struct tpm_chip *chip)
-{
-       outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND);
-}
-
-static u8 tpm_nsc_status(struct tpm_chip *chip)
-{
-       return inb(chip->vendor->base + NSC_STATUS);
-}
-
-static struct file_operations nsc_ops = {
-       .owner = THIS_MODULE,
-       .llseek = no_llseek,
-       .open = tpm_open,
-       .read = tpm_read,
-       .write = tpm_write,
-       .release = tpm_release,
-};
-
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR|S_IWGRP, NULL, tpm_store_cancel);
-
-static struct attribute * nsc_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       0,
-};
-
-static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs };
-
-static struct tpm_vendor_specific tpm_nsc = {
-       .recv = tpm_nsc_recv,
-       .send = tpm_nsc_send,
-       .cancel = tpm_nsc_cancel,
-       .status = tpm_nsc_status,
-       .req_complete_mask = NSC_STATUS_OBF,
-       .req_complete_val = NSC_STATUS_OBF,
-       .req_canceled = NSC_STATUS_RDY,
-       .attr_group = &nsc_attr_grp,
-       .miscdev = { .fops = &nsc_ops, },
-};
-
-static int __devinit tpm_nsc_init(struct pci_dev *pci_dev,
-                                 const struct pci_device_id *pci_id)
-{
-       int rc = 0;
-       int lo, hi;
-       int nscAddrBase = TPM_ADDR;
-
-
-       if (pci_enable_device(pci_dev))
-               return -EIO;
-
-       /* select PM channel 1 */
-       tpm_write_index(nscAddrBase,NSC_LDN_INDEX, 0x12);
-
-       /* verify that it is a National part (SID) */
-       if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) {
-               nscAddrBase = (tpm_read_index(TPM_SUPERIO_ADDR, 0x2C)<<8)|
-                       (tpm_read_index(TPM_SUPERIO_ADDR, 0x2B)&0xFE);
-               if (tpm_read_index(nscAddrBase, NSC_SID_INDEX) != 0xF6) {
-                       rc = -ENODEV;
-                       goto out_err;
-               }
-       }
-
-       hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI);
-       lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO);
-       tpm_nsc.base = (hi<<8) | lo;
-
-       dev_dbg(&pci_dev->dev, "NSC TPM detected\n");
-       dev_dbg(&pci_dev->dev,
-               "NSC LDN 0x%x, SID 0x%x, SRID 0x%x\n",
-               tpm_read_index(nscAddrBase,0x07), tpm_read_index(nscAddrBase,0x20),
-               tpm_read_index(nscAddrBase,0x27));
-       dev_dbg(&pci_dev->dev,
-               "NSC SIOCF1 0x%x SIOCF5 0x%x SIOCF6 0x%x SIOCF8 0x%x\n",
-               tpm_read_index(nscAddrBase,0x21), tpm_read_index(nscAddrBase,0x25),
-               tpm_read_index(nscAddrBase,0x26), tpm_read_index(nscAddrBase,0x28));
-       dev_dbg(&pci_dev->dev, "NSC IO Base0 0x%x\n",
-               (tpm_read_index(nscAddrBase,0x60) << 8) | tpm_read_index(nscAddrBase,0x61));
-       dev_dbg(&pci_dev->dev, "NSC IO Base1 0x%x\n",
-               (tpm_read_index(nscAddrBase,0x62) << 8) | tpm_read_index(nscAddrBase,0x63));
-       dev_dbg(&pci_dev->dev, "NSC Interrupt number and wakeup 0x%x\n",
-               tpm_read_index(nscAddrBase,0x70));
-       dev_dbg(&pci_dev->dev, "NSC IRQ type select 0x%x\n",
-               tpm_read_index(nscAddrBase,0x71));
-       dev_dbg(&pci_dev->dev,
-               "NSC DMA channel select0 0x%x, select1 0x%x\n",
-               tpm_read_index(nscAddrBase,0x74), tpm_read_index(nscAddrBase,0x75));
-       dev_dbg(&pci_dev->dev,
-               "NSC Config "
-               "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
-               tpm_read_index(nscAddrBase,0xF0), tpm_read_index(nscAddrBase,0xF1),
-               tpm_read_index(nscAddrBase,0xF2), tpm_read_index(nscAddrBase,0xF3),
-               tpm_read_index(nscAddrBase,0xF4), tpm_read_index(nscAddrBase,0xF5),
-               tpm_read_index(nscAddrBase,0xF6), tpm_read_index(nscAddrBase,0xF7),
-               tpm_read_index(nscAddrBase,0xF8), tpm_read_index(nscAddrBase,0xF9));
-
-       dev_info(&pci_dev->dev,
-                "NSC TPM revision %d\n",
-                tpm_read_index(nscAddrBase, 0x27) & 0x1F);
-
-       /* enable the DPM module */
-       tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01);
-
-       if ((rc = tpm_register_hardware(&pci_dev->dev, &tpm_nsc)) < 0)
-               goto out_err;
-
-       return 0;
-
-out_err:
-       pci_disable_device(pci_dev);
-       return rc;
-}
-
-static void __devexit tpm_nsc_remove(struct pci_dev *pci_dev) 
-{
-       struct tpm_chip *chip = pci_get_drvdata(pci_dev);
-
-       if ( chip )
-               tpm_remove_hardware(chip->dev);
-}
-
-static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0)},
-       {PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)},
-       {0,}
-};
-
-MODULE_DEVICE_TABLE(pci, tpm_pci_tbl);
-
-static struct pci_driver nsc_pci_driver = {
-       .name = "tpm_nsc",
-       .id_table = tpm_pci_tbl,
-       .probe = tpm_nsc_init,
-       .remove = __devexit_p(tpm_nsc_remove),
-       .suspend = tpm_pm_suspend,
-       .resume = tpm_pm_resume,
-};
-
-static int __init init_nsc(void)
-{
-       return pci_register_driver(&nsc_pci_driver);
-}
-
-static void __exit cleanup_nsc(void)
-{
-       pci_unregister_driver(&nsc_pci_driver);
-}
-
-fs_initcall(init_nsc);
-module_exit(cleanup_nsc);
-
-MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
-MODULE_DESCRIPTION("TPM Driver");
-MODULE_VERSION("2.0");
-MODULE_LICENSE("GPL");
index ec1846590513cad7b54c038579c0ce9381b5e26c..9767350828b516b04ebecb7f0b53ad33fc5686dc 100644 (file)
@@ -86,11 +86,7 @@ static void __exit cleanup_xen(void);
 static inline struct transmission *
 transmission_alloc(void)
 {
-       struct transmission *t = kmalloc(sizeof(*t), GFP_KERNEL);
-       if (t) {
-               memset(t, 0x0, sizeof(*t));
-       }
-       return t;
+       return kzalloc(sizeof(struct transmission), GFP_KERNEL);
 }
 
 static inline unsigned char *